Attribute VB_Name = "modMinMaxInfo"
'***************************************************************
' (c) Copyright 2000 Matthew J. Curland
'
' This file is from the CD-ROM accompanying the book:
' Advanced Visual Basic 6: Power Techniques for Everyday Programs
'   Author: Matthew Curland
'   Published by: Addison-Wesley, July 2000
'   ISBN: 0-201-70712-8
'   http://www.PowerVB.com
'***************************************************************
Option Explicit

'Minimal subclassing declares
Public Const GWL_WNDPROC As Long = -4
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal wndrpcPrev As Long, ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

'MinMaxInfo declares
Public Const WM_GETMINMAXINFO As Long = &H24
Public Type POINTAPI
    x As Long
    y As Long
End Type
Public Type MINMAXINFO
    ptReserved As POINTAPI
    ptMaxSize As POINTAPI
    ptMaxPosition As POINTAPI
    ptMinTrackSize As POINTAPI
    ptMaxTrackSize As POINTAPI
End Type
Public Type OwnedMinMaxInfo
    Owner As ArrayOwner
    pSA() As MINMAXINFO
End Type
Public g_DerefMinMaxInfo As OwnedMinMaxInfo

Public Sub Main()
    With g_DerefMinMaxInfo
        InitArrayOwner .Owner, LenB(.pSA(0)), 0
    End With
    frmMinMaxInfo.Show
End Sub

'Redirection function for PushParamThunk
Public Function RedirectMinMaxInfoWindowProc(ByVal This As frmMinMaxInfo, ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    RedirectMinMaxInfoWindowProc = This.WindowProc(hWnd, uMsg, wParam, lParam)
End Function
